Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boards: Seeeduino XIAO BLE charge current select. #10

Open
wants to merge 1 commit into
base: v3.0.0+zmk-fixes
Choose a base branch
from

Conversation

petejohanson
Copy link

Add board Kconfig option to allow selecting a fixed charge current, either 50mA or 100mA, at startup.

Signed-off-by: Peter Johanson [email protected]

Add board Kconfig option to allow selecting a fixed charge
current, either 50mA or 100mA, at startup.

Signed-off-by: Peter Johanson <[email protected]>
@caksoylar
Copy link

After a haphazard attempt to update this for Zephyr 3.2 (see below), the config seems to be working well. I missed when the charging light turned off so I couldn't calculate for sure, but I definitely got >65 mAh whereas I used to get <50 mAh without this patch.

diff --git a/boards/arm/seeeduino_xiao_ble/board.c b/boards/arm/seeeduino_xiao_ble/board.c
index 79143a9c5f..f4312df2a8 100644
--- a/boards/arm/seeeduino_xiao_ble/board.c
+++ b/boards/arm/seeeduino_xiao_ble/board.c
@@ -4,16 +4,15 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
-#include <init.h>
+#include <zephyr/init.h>
 #include <hal/nrf_gpio.h>
 #include <nrfx.h>
-#include <device.h>
-#include <drivers/gpio.h>
+#include <zephyr/device.h>
+#include <zephyr/drivers/gpio.h>
 
-#include <logging/log.h>
+#include <zephyr/logging/log.h>
 LOG_MODULE_REGISTER(seeeduino_xiao_ble_board_init);
 
-#define XIAO_BLE_CHARGE_CTRL_PORT DT_LABEL(DT_NODELABEL(gpio0))
 #define XIAO_BLE_CHARGE_CTRL_PIN 13
 
 static int setup(const struct device *dev)
@@ -23,9 +22,9 @@ static int setup(const struct device *dev)
     const struct device *gpio;
     int err;
 
-	gpio = device_get_binding(XIAO_BLE_CHARGE_CTRL_PORT);
+    gpio = DEVICE_DT_GET(DT_NODELABEL(gpio0));
     if (!gpio) {
-                LOG_ERR("Could not bind device \"%s\"", XIAO_BLE_CHARGE_CTRL_PORT);
+        LOG_ERR("Could not bind gpio0 device");
         return -ENODEV;
     }
 

@caksoylar
Copy link

I suppose this could be implemented with GPIO hogging in Zephyr 3.5. I'll drop a note here if I figure it out!

@ldab
Copy link

ldab commented Jan 2, 2024

I suppose this could be implemented with GPIO hogging in Zephyr 3.5. I'll drop a note here if I figure it out!

HOG is introduced in 3.3 btw

@proostas
Copy link

I found a way to make it work with GPIO hogging.

&gpio0 {
    fastbatcharge: fast-battery-charge {
        gpio-hog;
        gpios = <13 GPIO_ACTIVE_HIGH>;
        output-low;
        line-name = "Fast Battery Charge";
    };
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants